package com.hsav.kcxb.view;

import android.content.Context;
import android.text.Layout;
import android.util.AttributeSet;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.ListView;

import com.hsav.kcxb.R;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.concurrent.LinkedBlockingDeque;

/**
 * Created by zhao on 2016/12/24.
 */

public class AreaView extends LinearLayout {
    private ListView mProvinceLV;
    private ListView mCityLV;
    private ArrayList<String> mProvinceList = new ArrayList<String>();
    private LinkedList<String> mCityList = new LinkedList<String>();
    private SparseArray<LinkedList<String>> mItemList = new SparseArray<LinkedList<String>>();


    public AreaView(Context context) {
        super(context);
        initView(context);
    }

    public AreaView(Context context, AttributeSet attrs) {
        super(context, attrs);
        initView(context);
    }

    public AreaView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initView(context);
        initData();
    }

    private void initData() {
        for (int i = 0; i < 10; i++) {
            mProvinceList.add("第" + i + "行");
            LinkedList<String> itemList = new LinkedList<String>();
            for (int j = 0; j < 15; j++) {
                itemList.add("第" + i + "行" + "," + "第" + j + "个");
            }
            mItemList.append(i, itemList);
        }
    }

    private void initView(Context context) {
        LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View viewRoot = layoutInflater.inflate(R.layout.view_area, this, true);
        mProvinceLV = (ListView) viewRoot.findViewById(R.id.lv_area_province);
        mCityLV = (ListView) viewRoot.findViewById(R.id.lv_area_city);
    }

    private class ProvinceAdapter extends BaseAdapter{

        @Override
        public int getCount() {
            return 0;
        }

        @Override
        public Object getItem(int position) {
            return null;
        }

        @Override
        public long getItemId(int position) {
            return 0;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            return null;
        }
    }
}
